package com.sumer.psychology.common.application;

import com.sumer.psychology.blog.application.command.BlogApplicationService;
import com.sumer.psychology.blog.application.command.CategoryApplicationService;
import com.sumer.psychology.blog.application.query.BlogQueryApplicationService;
import com.sumer.psychology.blog.application.query.BlogTagQueryApplicationService;
import com.sumer.psychology.blog.application.query.CategoryQueryApplicationService;
import com.sumer.psychology.comment.application.command.CommentApplicationService;
import com.sumer.psychology.comment.application.query.CommentQueryApplicationService;
import com.sumer.psychology.common.domain.model.UserService;
import com.sumer.psychology.common.spring.ApplicationContextProvider;
import com.sumer.psychology.friend.application.command.FriendshipApplicationService;
import com.sumer.psychology.friend.application.query.FriendshipQueryApplicationService;
import com.sumer.psychology.microblog.application.command.MicroBlogApplicationService;
import com.sumer.psychology.microblog.application.query.MicroBlogQueryApplicationService;
import com.sumer.psychology.photo.application.command.AlbumApplicationService;
import com.sumer.psychology.photo.application.command.PhotoApplicationService;
import com.sumer.psychology.photo.application.query.AlbumQueryApplicationService;
import com.sumer.psychology.photo.application.query.PhotoQueryApplicationService;
import com.sumer.psychology.sharing.application.command.SharedResourceApplicationService;
import com.sumer.psychology.sharing.application.query.SharedResourceQueryApplicationService;
import com.sumer.psychology.space.application.command.SpaceApplicationService;
import com.sumer.psychology.space.application.query.SpaceQueryApplicationService;
import com.sumer.psychology.space.infrastructure.persistence.mongo.MongoProfileRepository;
import com.sumer.psychology.statistics.infrastructure.MongoVisitStatisticsRepository;

/**
 * 应用工厂服务
 * <p/>
 * User: zhenguang.zhu
 * Date: 2014/9/15
 * Time: 14:03
 */
public class ApplicationServiceRegistry {
    public static BlogApplicationService blogApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(BlogApplicationService.class);
    }

    public static CategoryApplicationService categoryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(CategoryApplicationService.class);
    }

    public static CommentApplicationService commentApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(CommentApplicationService.class);
    }

    public static FriendshipApplicationService friendshipApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(FriendshipApplicationService.class);
    }

    public static MicroBlogApplicationService microBlogApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(MicroBlogApplicationService.class);
    }

    public static SharedResourceApplicationService sharedResourceApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(SharedResourceApplicationService.class);
    }

    public static PhotoApplicationService photoApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(PhotoApplicationService.class);
    }

    public static AlbumApplicationService albumApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(AlbumApplicationService.class);
    }

    public static BlogQueryApplicationService blogQueryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(BlogQueryApplicationService.class);
    }

    public static CategoryQueryApplicationService categoryQueryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(CategoryQueryApplicationService.class);
    }

    public static BlogTagQueryApplicationService blogTagQueryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(BlogTagQueryApplicationService.class);
    }

    public static CommentQueryApplicationService commentQueryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(CommentQueryApplicationService.class);
    }

    public static MicroBlogQueryApplicationService microBlogQueryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(MicroBlogQueryApplicationService.class);
    }

    public static AlbumQueryApplicationService albumQueryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(AlbumQueryApplicationService.class);
    }

    public static PhotoQueryApplicationService photoQueryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(PhotoQueryApplicationService.class);
    }

    public static SharedResourceQueryApplicationService sharedResourceQueryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(SharedResourceQueryApplicationService.class);
    }

    public static SpaceQueryApplicationService spaceApplicationQueryService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(SpaceQueryApplicationService.class);
    }

    public static UserService userService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(UserService.class);
    }

    public static MongoVisitStatisticsRepository visitStatisticsRepository() {
        return ApplicationContextProvider.instance().applicationContext().getBean(MongoVisitStatisticsRepository.class);
    }

    public static CommonQueryApplicationService commonQueryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(CommonQueryApplicationService.class);
    }

    public static FriendshipQueryApplicationService friendshipQueryApplicationService() {
        return ApplicationContextProvider.instance().applicationContext().getBean(FriendshipQueryApplicationService.class);
    }

    public static MongoProfileRepository profileRepository() {
        return ApplicationContextProvider.instance().applicationContext().getBean(MongoProfileRepository.class);
    }

    public static SpaceApplicationService spaceApplicationService(){
        return ApplicationContextProvider.instance().applicationContext().getBean(SpaceApplicationService.class);
    }

}
